package com.tg.app.adapter;

import android.annotation.SuppressLint;
import android.content.Context;

import com.tg.app.bean.DevicePresetPoints;

public class PrePositionFragmentAdapter extends PrePositionAdapter {
    public static final String TAG = PrePositionFragmentAdapter.class.getSimpleName();
    public PrePositionFragmentAdapter(Context context, PrePositionListener listener) {
        super(context, listener);
    }

    @Override
    public String getMode() {
        return MODE_SWITCH;
    }

    @SuppressLint("NotifyDataSetChanged")
    @Override
    public void setWatchPosInfo(int watchPosNumber, int idleTime) {
        super.setWatchPosInfo(watchPosNumber, idleTime);
        notifyDataSetChanged();
    }

    @Override
    public DevicePresetPoints getDevicePresetPoints(int position) {
        for (DevicePresetPoints p : prePositions) {
            if (p.num == position + 1) {
                return p;
            }
        }
        return null;
    }

    @Override
    public int getItemViewType(int position) {
        for (DevicePresetPoints p : prePositions) {
            if (position + 1 == p.num) {
                return ACTION_ITEM;
            }
        }
        return ACTION_ADD;
    }
}